package com.wanwu.channel.common.enums;

/**
 * 第三方返回码：通讯码，业务状态码
 */
public enum ChannelThirdReturnCode {

    FAIL("FAIL"),
    SUCCESS("SUCCESS"),

    ;

    private String code;


    ChannelThirdReturnCode(String code) {
        this.code = code;
    }

    public static ChannelThirdReturnCode get(String code) {
        for (ChannelThirdReturnCode type : ChannelThirdReturnCode.values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        //未知通讯码当失败码处理
        return ChannelThirdReturnCode.FAIL;
    }

    public boolean check(String code){
        return this.code.equals(code);
    }
}
